#ifndef CHANNEL_H
#define CHANNEL_H
using namespace std;


#ifdef WIN32
#include <windows.h>
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <arpa/inet.h>
#endif

#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>

#include "libssh2.h"
#include "libssh2_sftp.h"



const int CHANNEL_READ_TIMEOUT = 3000;

class Channel
{
public:
    Channel(LIBSSH2_CHANNEL *channel);
    ~Channel(void);

    string Read(const string &cmd = "", const string &strend = "#", int timeout = CHANNEL_READ_TIMEOUT );
    bool   Write(const string &data);
private:
    Channel(const Channel&);
    Channel operator=(const Channel&);
    void my_u_sleep(int time);
private:
    LIBSSH2_CHANNEL *m_channel;
};

#endif // CHANNEL_H
